---
sidebar_position: 4
tags: [invert]
---

# `exclude`

Exclude by path using Regex to match only the files that should be performed.

## CLI

```bash
# Excluding directories and files from tests

npx poku --exclude='some-file-or-dir' ./test
```

```bash
# Excluding directories and files from tests

npx poku --exclude='some-file-or-dir|other-file-or-dir' ./test
```

## API

```ts
/**
 * Excluding  directories from tests
 */

await poku('./test', {
  exclude: /\/(helpers|tools)\//,
});
```

```ts
/**
 * Excluding  directories from tests
 */

await poku('./test', {
  exclude: [/\/helpers\//, /\/tools\//],
});
```

```ts
/**
 * Excluding specific files from tests
 */

await poku('./test', {
  exclude: /(index|common).test.ts/,
});
```

```ts
/**
 * Excluding specific files from tests
 */

await poku('./test', {
  exclude: [/index.test.ts/, /common.test.ts/],
});
```

```ts
/**
 * Excluding directories and files from tests
 */

await poku('./test', {
  exclude: /\/(helpers|tools)\/|(index|common).test.ts/,
});
```

```ts
/**
 * Excluding directories and files from tests
 */

await poku('./test', {
  exclude: [/\/helpers\//, /\/tools\//, /index.test.ts/, /common.test.ts/],
});
```
